/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Unit;

import java.util.ArrayList;

/**
 *
 * @author tuyentran
 */
public class Element {
    private double inside;
    private double outside;
    private int start;
    private int end;
    private Element father;
    private ArrayList<Element> children;
    private String label;
    private int usingRuleQuantity;
    
    public String getFullLabel(Element e) {
        if (e.getChildren() == null || e.getChildren().size() == 0) {
            return e.getLabel();
        }
        else {
            // Get all children and foreach
            String result = "";
            for (int i = 0; i < e.children.size(); i++) {
                Element child = e.children.get(i);
                
                result += getFullLabel(child) + " ";
            }
            return result;
        }
    }

    public Element(Element e){
        this.label = e.label;
        this.start = e.start;
        this.end = e.end;
        this.inside = e.inside;
        this.outside = e.outside;
    }
    
    public Element(String label, int start, int end){
        this.label = label;
        this.start = start;
        this.end = end;
        this.children = new ArrayList<Element>();
        this.inside = 0;
        this.outside = 0;
    }
    
    /**
     * @return the inside
     */
    public double getInside() {
        return inside;
    }

    /**
     * @param inside the inside to set
     */
    public void setInside(double inside) {
        this.inside = inside;
    }

    /**
     * @return the outside
     */
    public double getOutside() {
        return outside;
    }

    /**
     * @param outside the outside to set
     */
    public void setOutside(double outside) {
        this.outside = outside;
    }

    /**
     * @return the start
     */
    public int getStart() {
        return start;
    }

    /**
     * @param start the start to set
     */
    public void setStart(int start) {
        this.start = start;
    }

    /**
     * @return the end
     */
    public int getEnd() {
        return end;
    }

    /**
     * @param end the end to set
     */
    public void setEnd(int end) {
        this.end = end;
    }

    /**
     * @return the father
     */
    public Element getFather() {
        return father;
    }

    /**
     * @param father the father to set
     */
    public void setFather(Element father) {
        this.father = father;
    }

    /**
     * @return the children
     */
    public ArrayList<Element> getChildren() {
        return children;
    }

    /**
     * @param children the children to set
     */
    public void setChildren(ArrayList<Element> children) {
        this.children = children;
    }

    /**
     * @param add child to the children
     */
    public void addChild(Element child) {
        this.children.add(child);
    }

    /**
     * @return the label
     */
    public String getLabel() {
        return label;
    }

    /**
     * @param label the label to set
     */
    public void setLabel(String label) {
        this.label = label;
    }

    /**
     * @return the usingRuleQuantity
     */
    public int getUsingRuleQuantity() {
        return usingRuleQuantity;
    }

    /**
     * @param usingRuleQuantity the usingRuleQuantity to set
     */
    public void setUsingRuleQuantity(int usingRuleQuantity) {
        this.usingRuleQuantity = usingRuleQuantity;
    }
    
}
